package com.basic.bio.file;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;

/**
 * @Description:
 * @Date: 2024-03-28 14:41
 * @Author: wz
 **/
public class Server {

    public static void main(String[] args) {
        try {
            ServerSocket ss = new ServerSocket(9090);
            InputStream is = ss.accept().getInputStream();
            FileOutputStream fos = new FileOutputStream("C:\\Users\\Mr.Wang\\Desktop\\server.png");
            int len;
            byte[] buf = new byte[1024];
            while ((len = is.read(buf)) !=-1){
                fos.write(buf,0,len);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
